#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5e5 + 5;
const int P = 131;
using ull = unsigned long long;
int n, m;
string s;
ull f[N], g[N], h[N];
int ans1[N], ans2[N];
bool check(int l, int r) {
  ull x = f[r] - f[l - 1] * h[r + 1 - l];
  ull y = g[l] - g[r + 1] * h[r + 1 - l];
  return x == y;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> s;
  n = s.size();
  h[0] = 1;
  rep(i, 1, n) h[i] = h[i - 1] * P;
  rep(i, 1, n) f[i] = f[i - 1] * P + s[i - 1] - 'A';
  per(i, n, 1) g[i] = g[i + 1] * P + s[i - 1] - 'A';
  rep(i, 1, n) {
    int l = 0, r = min(i - 1, n - i);
    while (l <= r) {
      int mid = (l + r) / 2;
      if (check(i - mid, i + mid))
        l = mid + 1;
      else
        r = mid - 1;
    }
    ans1[i] = r;
  }
  rep(i, 1, n) {
    int l = 1, r = min(i, n - i);
    while (l <= r) {
      int mid = (l + r) / 2;
      if (check(i + 1 - mid, i + mid))
        l = mid + 1;
      else
        r = mid - 1;
    }
    ans2[i] = r;
  }
  int l = n;
  rep(i, 1, n) {
    int r = i + ans1[i];
    if (r == n) l = min(l, i - ans1[i]);
    r = i + ans2[i];
    if (r == n) l = min(l, i + 1 - ans2[i]);
  }
  string t = s.substr(0, l - 1);
  reverse(t.begin(), t.end());
  s += t;
  cout << s;
  return 0;
}